package Tree;

public class Main {
    public static void main(String[] args) {
        BinaryTree binaryTree = new BinaryTree();
        BinaryTree.TreeNode root =  binaryTree.createTree();
        System.out.print("前序遍历");
        binaryTree.preOrder(root);
        System.out.println();
        System.out.print("中序遍历");
        binaryTree.inOrder(root);
        System.out.println();
        System.out.print("后序遍历");
        binaryTree.postOrder(root);
        System.out.println();
        System.out.print("树的节点个数：");
        binaryTree.size(root);
        System.out.println(BinaryTree.nodeSize);
        System.out.println(binaryTree.size2(root));
        System.out.print("叶子节点个数：");
        binaryTree.getLeafNodeCount1(root);
        System.out.println(binaryTree.getLeafNodeCount2(root));
        System.out.println(binaryTree.leafSize);
        System.out.print("第三层节点个数：");
        System.out.println(binaryTree.getKLevelNodeCount(root,3));
        System.out.print("树的高度：");
        System.out.println(binaryTree.getHeight(root));
        System.out.print("寻找值为val的节点：");
        System.out.println(binaryTree.find(root,'E').val);
        binaryTree.invertTree(root);

    }
}
